package jupitermouse.site.example.scala.batch.tolerance

import org.apache.flink.api.scala.ExecutionEnvironment

/**
  * @author qiqiang.ren@hand-china.com
  * @desc
  * <p>
  *   this is DataSet API 容错
  * Flink的容错机制（在出现故障时恢复程序并继续执行它们）
  * 此类故障包括机器硬件故障，网络故障，瞬态程序故障等。
  * </p>
  */
object FaultToleranceApp {

  def main(args: Array[String]): Unit = {
    val env = ExecutionEnvironment.getExecutionEnvironment;

    /**
      *<p>
      *   设置重试次数
      *  还可以通过flink-conf.yaml配置 execution-retries.default: 3
      *  or see [[ExecutionEnvironment.setRestartStrategy()]]
      *</p>
      */
    env.setNumberOfExecutionRetries(3)
    /**
      *<p>
      *   设置重试延迟
      *  还可以通过flink-conf.yaml配置 execution-retries.delay: 10 s
      *  or see [[ExecutionEnvironment.setRestartStrategy()]]
      *</p>
      */
    env.setNumberOfExecutionRetries(5000) //5000 milliseconds delay


  }

}
